import { defineStore } from 'pinia';
import { ref } from 'vue';
import { routesList } from '@/router/modules/routeList';
import type { RouteRecordRaw } from 'vue-router';

const useSettingStore: any = defineStore('setting', () => {
  // 菜单折叠
  const asideMenuShow = ref<boolean>(true);

  // 修改菜单折叠
  const toggleAsideMenuShow = (): void => {
    asideMenuShow.value = !asideMenuShow.value;
  };

  // 路由菜单数据
  const menuList = ref<RouteRecordRaw[]>(routesList);

  // 修改路由菜单数据
  const changeMenuList = (): void => {};

  // 是否刷新
  const isRefresh = ref<boolean>(false);

  // 切换刷新状态
  const toggleRefresh = () => {
    isRefresh.value = !isRefresh.value;
  };
  return {
    asideMenuShow, // 菜单折叠
    toggleAsideMenuShow,
    menuList, // 菜单列表
    changeMenuList,
    isRefresh, // 刷新状态
    toggleRefresh
  };
});

export default useSettingStore;
